package com.game_info.service.impl;

import java.util.List;

import com.game_info.mapper.GamesMsgMapper;
import com.game_info.service.GamesMsgService;
import com.game_info.vo.GamesMsg;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * games_msg 表Service业务层处理
 *
 * @author ttj
 * @date 2020-04-14
 */
@Service
public class GamesMsgServiceImpl implements GamesMsgService {
    @Autowired
    private GamesMsgMapper gamesMsgMapper;

    /**
     * 查询
     *
     * @param msgId
     * @return GamesMsg对象
     */
    @Override
    public GamesMsg selectGamesMsgById(Integer msgId) {
        return gamesMsgMapper.selectGamesMsgById(msgId);
    }

    /**
     * 查询留言列表
     *
     * @param gamesMsg
     * @return GamesMsg对象列表集合
     */
    @Override
    public List<GamesMsg> selectGamesMsgList(GamesMsg gamesMsg) {
        return gamesMsgMapper.selectGamesMsgList(gamesMsg);
    }

    /**
     * 根据msgBelong查询留言
     *
     * @param msgBelong
     * @return 留言列表
     */
    @Override
    public List<GamesMsg> selectMsgsByGid(String msgBelong) {
        return gamesMsgMapper.selectMsgsByGid(msgBelong);
    }

    /**
     * 根据msgBelong某个游戏的留言总数
     * @param msgBelong
     * @return 留言总数
     */
    @Override
    public Integer selectCountByMsgBelong(String msgBelong) {
        return gamesMsgMapper.selectCountByMsgBelong(msgBelong);
    }

    /**
     * 根据msgBelong查询留言并分页
     * @param msgBelong limit
     * @return 留言对象集合
     */
    @Override
    public List<GamesMsg> selectMsgsLimitByGid(String msgBelong, Integer limit) {
        return gamesMsgMapper.selectMsgsLimitByGid(msgBelong,limit);
    }

    /**
     * 获取全部留言总数
     * @return
     */
    public Integer getMsgCount(){
        return gamesMsgMapper.getMsgCount();
    }

    /**
     * 分页查询
     * @param pagesSize
     * @param startPages
     * @return
     */
    @Override
    public List<GamesMsg> selectMsgLimit(Integer startPages,Integer pagesSize){
        return gamesMsgMapper.selectMsgLimit(startPages,pagesSize);
    }

    /**
     * 根据关键词模糊查询全部字段信息
     *
     * @param keyword
     * @return
     */
    public List<GamesMsg> selectLikeKeyword(String keyword) {
        return gamesMsgMapper.selectLikeKeyword(keyword);
    }

    /**
     * 新增留言
     *
     * @param gamesMsg
     * @return 结果
     */
    @Override
    public int insertGamesMsg(GamesMsg gamesMsg) {
        return gamesMsgMapper.insertGamesMsg(gamesMsg);
    }

    /**
     * 修改留言
     *
     * @param gamesMsg
     * @return 结果
     */
    @Override
    public int updateGamesMsg(GamesMsg gamesMsg) {
        return gamesMsgMapper.updateGamesMsg(gamesMsg);
    }

    /**
     * 批量删除留言
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteGamesMsgByIds(String ids) {
        return gamesMsgMapper.deleteGamesMsgByIds(ids.split(""));
    }

    /**
     * 删除单个留言
     *
     * @param msgId
     * @return 结果
     */
    @Override
    public int deleteGamesMsgById(Integer msgId) {
        return gamesMsgMapper.deleteGamesMsgById(msgId);
    }
}
